/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import { TaskNames } from '../../common/task-names.js';
import { PackageHar } from '../../har/package-har.js';
import { LegacyPackageHar } from '../../legacy-tasks/har/legacy-package-har.js';
import { ModuleTaskService } from '../../service/module-task-service.js';
import { TargetTaskService } from '../../service/target-task-service.js';
import { AbstractModuleHookTask } from '../abstract-module-hook-task.js';
import CommonHookTask = TaskNames.CommonHookTask;

/**
 * 组装Hap打包的任务流
 *
 * @since 2022/1/20
 */
export class AssembleHar extends AbstractModuleHookTask {
  constructor(moduleService: ModuleTaskService, isFaMode: boolean) {
    super(moduleService, isFaMode, CommonHookTask.ASSEMBLE_HAR);
  }

  initTaskDepends(taskTargetService: TargetTaskService) {
    const name: string = this._isFaMode ? LegacyPackageHar.name : PackageHar.name;
    this.dependsOn(`${taskTargetService.getTargetData().getTargetName()}@${name}`);
  }
}
